package com.travel.member.web;

import com.travel.common.utils.R;
import com.travel.member.service.MemberSignService;
import com.travel.member.vo.SignVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping
public class SignController {

    @Autowired
    MemberSignService memberSignService;

    @Autowired
    StringRedisTemplate redisTemplate;

    /**
     * 签到方法
     */
    @RequestMapping("/member/sign")
    public R sign(){
        memberSignService.sign();
        return R.ok();
    }

    /**
     * 获取本月的签到记录
     */
    @RequestMapping("/member/signRecord")
    public R signRecord(){
        List<SignVo> signVoList = memberSignService.signRecord();
        return R.ok().put("signList",signVoList);
    }

    /**
     * 获取本月连续签到次数
     */
    @RequestMapping("/member/signCount")
    public R signCount(){
        Integer signCount = memberSignService.signCount();
        return R.ok().put("signCount",signCount);
    }

}
